package com.leyou.order.controller;


import com.leyou.common.pojo.PageResult;
import com.leyou.order.dto.OrderVO;
import com.leyou.order.service.OrderCenterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class OrderCenterController {

    @Autowired
    private OrderCenterService orderCenterService;


    @GetMapping("/order/list")
    public ResponseEntity<PageResult<OrderVO>> getOrderList(
            @RequestParam(value = "status" ,required = false) Integer status ,
            @RequestParam("page") Integer num,
            @RequestParam("rows") Integer rows
    ){
        PageResult<OrderVO> orderByUserId = orderCenterService.findOrderByUserId(status, num, rows);
        return ResponseEntity.ok(orderByUserId);
    }

}
